<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/include/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=system_name%> - 添加产品报价信息</title>
	<%@include file="/WEB-INF/jsp/include/meta.jsp"%>
	
	<link href="<%=basePath%>css/common.css" rel="stylesheet" type="text/css" />
	<script src="<%=basePath%>js/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/pagebar.js"></script>
	<script type="text/javascript" src="fram/engine.js" ></script>
	<script type="text/javascript" src="fram/util.js" ></script>
	<script type="text/javascript" src="fram/interface/productService.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/DatePicker/WdatePicker.js" defer="defer"></script>
	
	<script type="text/javascript">
	function beforeSubmit(){			
		var supplierid=$("supplier.id").value;
		if(""==supplierid){alert("请选择供应商!");return false;}
		
		var productid=$("product.id").value;
		if(""==productid){alert("请选择对应产品!");return false;}
		
		//window.parent.submitStock();
			
		return true;
	}
	function browseProduct(){
		openWindow("<%=basePath%>trade/showProductList?"+Math.random());
	}
	function browseSupplier(){
		openWindow("<%=basePath%>trade/showSupplierList?"+Math.random());
	}
	function openWindow(url){        
		if (navigator.appVersion.indexOf("MSIE") == -1){
			window.open(url,'newWin','modal=yes,width=510,height=440,top=200,left=300,resizable=no,depended=yes,scrollbars=no');
	        return;
	    }else{
	    	if(navigator.appVersion.match(/MSIE ([\d.]+)/)[1]=='6.0'){
	    		showModalDialog(url,window,'dialogWidth:530px;dialogHeight:490px;')
	    	}else{
	        	showModalDialog(url,window,'dialogWidth:510px;dialogHeight:440px;')
	        }
	    }
	}
	function browsBack(id,name){
		$("supplierName").value=name;
		$("supplier.id").value=id;
	}
	function browsBackProduct(id,name){
		$("productName").value=name;
		$("product.id").value=id;
	}
	</script>
</head>

<body>
<form:form action="" method="post" name="myform" enctype="multipart/form-data" onsubmit="return beforeSubmit();">
	<table class="tabView" style="margin-top:5px">
		<c:choose>
			<c:when test="${not empty command.supplier.id}">
				<tr><th width="100">供应商信息：</th>
					<td colspan="3">
					<input type="text" id="supplierName" value="${command.supplier.companyName}" style="width:300px" disabled="disabled"/>
					<input type="text" name="supplier.id" id="supplier.id"  value="${command.supplier.id}" style="display:none"/>											
					</td>
				</tr>				
			</c:when>
			<c:otherwise>
				<tr><th width="100">选择供应商：</th>
					<td colspan="3">
					<input type="text" id="supplierName" value="${command.supplier.companyName}" style="width:300px" disabled="disabled"/>
					<input type="text" name="supplier.id" id="supplier.id"  value="${command.supplier.id}" style="display:none"/>				
					<input type="button" onclick="browseSupplier()" value="选择" style="width:40px;"/>	
					</td>
				</tr>
			</c:otherwise>
		</c:choose>
		<c:choose>
			<c:when test="${not empty command.product.id}">
				<tr><th>产品名称：</th><td>${command.product.name}</td>
				<th>产品货号：</th><td>${command.product.productNo}
					<input type="text" name="product.id" id="product.id"  value="${command.product.id}" style="display:none"/>
				</td></tr>
			</c:when>
			<c:otherwise>
				<tr><th width="100">选择产品信息：</th>
				<td colspan="3">
				<input type="text" id="productName" value="${command.product.name}" style="width:300px" disabled="disabled"/>
				<input type="text" name="product.id" id="product.id"  value="${command.product.id}" style="display:none"/>
				<input type="button" onclick="browseProduct()" value="选择" style="width:40px;"/>	
				</td>
				</tr>
			</c:otherwise>
		</c:choose>
		<tr><th>价格：</th><td><input type="text" name="price" id="price" value="${command.price}" /></td>
			<th>每箱数量：</th><td><input type="text" name="boxes" id="boxes" value="${command.boxes}"/></td></tr>			
		<tr><th>长：</th><td><input type="text" name="packingLong" id="packingLong" value="${command.packingLong}"/></td>
			<th>毛重：</th><td><input type="text" name="grossWeight" id="grossWeight" value="${command.grossWeight}"/></td>						
		<tr><th>宽：</th><td><input type="text" name="packingWidth" id="packingWidth" value="${command.packingWidth}"/></td>
			<th>净重：</th><td><input type="text" name="netWeight" id="netWeight" value="${command.netWeight}"/></td>
		<tr>
			<th>高：</th><td><input type="text" name="packingHeight" id="packingHeight" value="${command.packingHeight}"/></td>
			<th>报价时间：</th><td><input type="text" name="quoteTime" id="quoteTime" value="${command.quoteTime}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td></tr>
		<tr>
			<th>品质规格：</th><td>
			<textarea name="qualitySpecifications" id="qualitySpecifications" rows="3" cols="50" maxlength='200'>${command.qualitySpecifications}</textarea>
			</td>
			</tr>
		</tr>
		<tr><td colspan="2" style="text-align:right;height:"><input type="submit" value=" 提 交 " class="btn1" /></td>
			<td colspan="2" style="text-align:left;height:"><input type="reset" value=" 重置 " class="btn1" value="reset"/></td></tr>
	</table>
</form:form>
<script>
$(limit_textarea_input)
</script>
</body>
</html>
